package com.alks.function.controller.stockdept.pcfactorystockquery;

import com.alks.common.aop.ApiRestController;
import com.alks.common.aop.RoleCheck;
import com.alks.entity.data.response.ResponseInfo;
import com.alks.function.data.request.stockdept.pcfactorystockwork.*;
import com.alks.function.service.stockdept.pcfactorystockquery.IPcOtherMtlInService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@ApiRestController("/pcFactorStockQuery")
@Api(value = "仓储部查询", tags = "仓储部-仓储工厂作业-其他材料入库")
@Slf4j
@RoleCheck(prgIds = {"160104"})
public class PcOtherMtlInController {
    @Autowired
    IPcOtherMtlInService mtlService;

    @GetMapping("/getOtherMtlWaitQuery")
    @ApiOperation(value = "其他材料入库-待入库明细-查询", tags = "仓储部-仓储工厂作业-其他材料入库")
    public ResponseInfo getOtherMtlWaitQuery() {
        return mtlService.getOtherMtlWaitQuery();
    }

    @PutMapping("/getOtherMtlInQuery")
    @ApiOperation(value = "其他材料入库-入库明细-分页可条件查询", tags = "仓储部-仓储工厂作业-其他材料入库")
    public ResponseInfo getOtherMtlInQuery(@RequestBody OMtlWatiRequest request) {
        return mtlService.getOtherMtlInQuery(request,"I");
    }

    @PutMapping("/getComMtlQuery")
    @ApiOperation(value = "其他材料入库-通用材料-分页可条件查询", tags = "仓储部-仓储工厂作业-其他材料入库")
    public ResponseInfo getComMtlQuery(@RequestBody ComMtlRequest request) {
        return mtlService.getComMtlQuery(request);
    }

    @PutMapping("/getLotMtlQuery")
    @ApiOperation(value = "其他材料入库-指令材料-分页可条件查询", tags = "仓储部-仓储工厂作业-其他材料入库")
    public ResponseInfo getLotMtlQuery(@RequestBody LotMtlRequest request) {
        return mtlService.getLotMtlQuery(request, 1);
    }

    @PutMapping("/otherLotSubMtlQuery")
    @ApiOperation(value = "其他材料入库-指令子材料-条件查询", tags = "仓储部-仓储工厂作业-其他材料入库")
    public ResponseInfo otherLotMtlSubQuery(@RequestBody OMtlwaitAddRequest request) {
        return mtlService.otherLotSubMtlQuery(request);
    }

    @PutMapping("/getLotComMtlQuery")
    @ApiOperation(value = "其他材料入库-指令通用材料-分页可条件查询", tags = "仓储部-仓储工厂作业-其他材料入库")
    public ResponseInfo getLotComMtlQuery(@RequestBody LotComMtlRequest request) {
        return mtlService.getLotComMtlQuery(request);
    }

    @PutMapping("/otherMtlWaitStockAdd")
    @ApiOperation(value = "其他材料入库-待入库新增-新增", tags = "仓储部-仓储工厂作业-其他材料入库")
    public ResponseInfo otherMtlWaitStockAdd(@RequestBody OMtlwaitAddRequest request,
                                             @RequestParam @ApiParam("类型（1.通用 2.指令）") Integer type) {
        return mtlService.otherMtlWaitStockAdd(request, type);
    }

    @PutMapping("/otherMtlInStockAdd")
    @ApiOperation(value = "其他材料入库-入库批处理-新增", tags = "仓储部-仓储工厂作业-其他材料入库")
    public ResponseInfo otherMtlInStockAdd(@RequestBody OMtlInAddRequest request) {
        return mtlService.otherMtlInStockAdd(request, "I");
    }

    @PostMapping("/otherMtlStockDelete")
    @ApiOperation(value = "其他材料入库-整单删除-删除", tags = "仓储部-仓储工厂作业-其他材料入库")
    public ResponseInfo otherMtlStockDelete(@RequestParam @ApiParam("入库单号slipNo") String slipNo) {
        return mtlService.otherMtlStockDelete(slipNo,"I");

    }

    @PutMapping("/otherMtlWaitStockUpdate")
    @ApiOperation(value = "其他材料入库-待入库数据修改-修改", tags = "仓储部-仓储工厂作业-其他材料入库")
    public ResponseInfo otherMtlWaitStockUpdate(@RequestBody List<OMtlWatiUpRequest> request) {
        return mtlService.otherMtlWaitStockUpdate(request, "I");
    }

    @GetMapping("/otherMtlInBack")
    @ApiOperation(value = "其他材料入库-入库明细查询-回显", tags = "仓储部-仓储工厂作业-其他材料入库")
    public ResponseInfo otherMtlInBack() {
        return mtlService.otherMtlInBack();
    }

    @GetMapping("/otherComMtlBack")
    @ApiOperation(value = "其他材料入库-通用材料-回显", tags = "仓储部-仓储工厂作业-其他材料入库")
    public ResponseInfo otherComMtlBack(@RequestParam(required = false) String mtlType) {
        return mtlService.otherComMtlBack(mtlType);
    }

    @GetMapping("/otherLotMtlBack")
    @ApiOperation(value = "其他材料入库-指令材料-回显", tags = "仓储部-仓储工厂作业-其他材料入库")
    public ResponseInfo otherLotMtlBack() {
        return mtlService.otherLotMtlBack();
    }

    @GetMapping("/otherLotComMtlBack")
    @ApiOperation(value = "其他材料入库-指令通用子材料-回显", tags = "仓储部-仓储工厂作业-其他材料入库")
    public ResponseInfo otherLotComMtlBack(@RequestParam(required = false) String mtlType) {
        return mtlService.otherLotComMtlBack(mtlType);
    }

}
